package drds.server.common;

import java.io.PrintWriter;
import java.io.StringWriter;

public class Exception {
	public static String getStackTrace(String tips, Throwable t) {
		if (tips == null) {
			tips = "";
		}
		return tips + ":\r\n" + getStackTrace(t);
	}

	public static String getStackTrace(Throwable t) {
		StringWriter sw = new StringWriter();
		PrintWriter pw = new PrintWriter(sw);
		try {
			t.printStackTrace(pw);
			return sw.toString();
		} finally {
			pw.close();
		}
	}
}
